added a conversion function from uri to iceorxy2 addressing scheme #71
Conversation
|
@catappreciationhours2 -- thanks for opening this!
Reading through this quickly, I think this should be: Since in this PR you've got implementation and testing of the UUri => ServiceName. I didn't spot implementation of handling of the payload. Let me know if I missed something |
PLeVasseur
left a comment
There was a problem hiding this comment.
Hey @catappreciationhours2 -- thanks for putting up this PR.
I've left some suggestions. Could you take a look?
If possible I'd like us to have one go-round with you and the other students attempting to make changes / post comments here before we meet up on Monday. Seem doable?
| } | ||
|
|
||
| fn compute_service_name(message: &UMessage) -> Result<String, UStatus> { | ||
| let join_segments = |segments: Vec<String>| segments.join("/"); |
There was a problem hiding this comment.
Neat approach. Think this is probably fine.
Was wondering if you'd considered using a function defined local to this function vs using a closure like this. Wondered on if there are any trade-offs between the two. I don't know of any off-hand and it might be useful for your learning.
sophokles73
left a comment
There was a problem hiding this comment.
Please also make sure to format your code properly using
cargo fmt -allor (better) configure VSCode to automatically format your code when saving a file.
|
@catappreciationhours2 please make sure to use the email address in your commits that you have used to register your Eclipse Foundation account and that you have signed the Eclipse Contributor Agreement (ECA) for. Otherwise, the |
|
All the changes have been incorporated in the most latest commit by @catappreciationhours2 . Just a few questions about our implementation of compute service names:
|
PLeVasseur
left a comment
There was a problem hiding this comment.
Hi @catappreciationhours2 -- thanks for the adjustments!
I left a few more comments. In general I think making use of the provided helper functions on UUri as @sophokles73 pointed out can help with readability of the code.
|
Hey @vidishac2004, let's tackle these questions:
I'm not sure I understand the question here. A If there's a sink
So taking these source and sink
I tried to explain how we end up with the I did this breakdown from
Yes, that seems reasonable. If a sink |
|
Amending my earlier comment a bit:
The situation here is a little more involved. I'll write something up about this. For now, I think we should check that if there is a sink I need to educate myself a little more on e.g. why the |
|
Additionally, I'm a little unclear on the Publish section of the UAttributes spec portion where it says that the sink
As far as I know in Protobuf the way we've defined |
Co-authored-by: Pete LeVasseur <plevasseur@gmail.com>
Co-authored-by: Kai Hudalla <sophokles.kh@gmail.com>
…matching and case branches
e5f5afa to
d71293a
Compare
No, the reason for allowing an authority name in the sink of Publish messages was to support the streamer use case so that the streamer can (canonically) route messages to outbound transports, in particular to an off-vehicle message broker when using the MQTT5 transport for connecting the vehicle to a cloud backend. IIRC the idea was, that the streamer would use information from its local uSubscription service to determine if the back end is interested in events produced locally in the vehicle and then add a sink URI containing the backend's authority name into such Publish messages before routing the message to the outbound transport. The MQTT5 transport would then use this information to create the topic name that the MQTT5 spec prescribes for off-vehicle communication. |
PLeVasseur
left a comment
There was a problem hiding this comment.
Hey @catappreciationhours2 -- thanks for the revision. I've taken a look and offered up some suggestions. Can you take a peek?
| assert_eq!(name, "up/device1/CD/0/4/B/device1/3AB/4/3/0"); | ||
| } | ||
|
|
||
| // performing failing tests for service name computation |
There was a problem hiding this comment.
These look reasonable. Would encourage you to think more about all the ways compute_service_name() can fail and try to cover those various branches.
If you've already covered -- great! If not, would be good to add those too.
There was a problem hiding this comment.
Leaving this open to see if you've given thought and covered all the possible branches.
PLeVasseur
left a comment
There was a problem hiding this comment.
Hey @vidishac2004 -- nearing completion! I left a few comments and the build is failing.
| assert_eq!(name, "up/device1/CD/0/4/B/device1/3AB/4/3/0"); | ||
| } | ||
|
|
||
| // performing failing tests for service name computation |
There was a problem hiding this comment.
Leaving this open to see if you've given thought and covered all the possible branches.
| let src_id = source.resource_id; | ||
| let sink_id = sink.map(|s| s.resource_id); | ||
|
|
||
| if src_id == 0 { |
There was a problem hiding this comment.
I think you could have kept the match, but refactored a bit to avoid the .contains().
This is a bit "wordy", but gets the job done.
Co-authored-by: Pete LeVasseur <plevasseur@gmail.com>
Co-authored-by: Pete LeVasseur <plevasseur@gmail.com>
This has now been resolved. |
Co-authored-by: Pete LeVasseur <plevasseur@gmail.com>

Helper methods:
Unit tests covering service name computation for:
missing URIs (return proper UCode::INVALID_ARGUMENT)
This sets up the foundation for integrating uProtocol transport over Iceoryx2.
Closes #66